<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<!-- view层 -->
		<div id="app">
			{{counter}}
		</div>
	</body>
	<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		//model
		const obj = {
				counter:0
			}
		//viewModel
		const app = new Vue({
			el: "#app",
			data: obj,
			methods:{
				add:function(){
					this.counter++;
					console.log('add被执行');
				},
				sub:function(){
					this.counter--;
					console.log('sub被执行');
				}
			}
		})
	</script>
</html>
